<template>
  <div style="width: 33.333%">
    <div class="container">数据分析</div>
    <div>
      <div id="charts_2" style="height: 400px; width: 100%"></div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import * as echarts from 'echarts'
import { ref, nextTick, onMounted } from 'vue'
let myChart = ref(<any>{})
onMounted(() => {
  const chartDom = document.getElementById('charts_2')
  myChart = echarts.init(chartDom)
})
const option = {
  tooltip: {
    trigger: 'item',
  },
  legend: {
    orient: 'vertical',
    left: 'left',
  },
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: '50%',
      data: [
        { value: 1048, name: 'Search Engine' },
        { value: 735, name: 'Direct' },
        { value: 580, name: 'Email' },
        { value: 484, name: 'Union Ads' },
        { value: 300, name: 'Video Ads' },
      ],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)',
        },
      },
    },
  ],
}
nextTick(() => {
  option && myChart.setOption(option)
})
</script>

<style lang="scss" scoped></style>
